<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use think\Db;

class ResendmailController extends HomeBaseController
{
    public function index() {
        if ($this->request->isPost()) {
            if (!empty($_POST['uname']) && !empty($_POST['uphone']) && !empty($_POST['uemail']) && !empty($_POST['orderid'])) {
                $_POST["create_time"] = date("Y-m-d H:i:s");
                $_POST["update_time"] = date("Y-m-d H:i:s");
                
                $result = DB::name('resendmail')->insertGetId($_POST);
                if ($result !== false) {
                    echo  json_encode(array('status'=>1, 'msg'=>'successed'));
                    exit;
                } else {
                    echo   json_encode(array('status'=>0, 'msg'=>'faild'));
                    exit;
                }
                    // $this->assign('page', $data);
                    // return $this->fetch();
            } else {
                echo  json_encode(array('status'=>0,'msg'=>'Field can not be empty!'));
                exit;
                // $this->assign('page', $data);
                // return $this->fetch();
            }
        }else{
           return $this->fetch();
        }
    }
}
